home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / scripts / control / lqe.m < prev    next >
Text File  |  1996-07-15  |  2KB  |  63 lines

  1. ## Copyright (C) 1996 John W. Eaton
  2. ##
  3. ## This file is part of Octave.
  4. ##
  5. ## Octave is free software; you can redistribute it and/or modify it
  6. ## under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2, or (at your option)
  8. ## any later version.
  9. ##
  10. ## Octave is distributed in the hope that it will be useful, but
  11. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. ## General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with Octave; see the file COPYING.  If not, write to the Free
  17. ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  18. ## 02111-1307, USA.
  19.  
  20. ## Usage: [k, p, e] = lqe (A, G, C, SigW, SigV {,Z})
  21. ##
  22. ## Linear quadratic estimator (Kalman filter) design for the
  23. ## continuous time system
  24. ##
  25. ##   dx/dt = A x + B u + G w
  26. ##       y = C x + D u + v
  27. ##
  28. ## where w, v are zero-mean gaussian noise processes with respective
  29. ## intensities SigW = cov (w, w) and SigV = cov (v, v).
  30. ##
  31. ## Z (if specified) is cov(w,v); otherwise cov(w,v) = 0.
  32. ##
  33. ## Observer structure is dz/dt = A z + B u + k( y - C z - D u).
  34. ##
  35. ## Returns:
  36. ##
  37. ##   k = observer gain, (A - K C) is stable
  38. ##   p = solution of algebraic Riccati equation
  39. ##   e = closed loop poles of (A - K C)
  40.  
  41. ## Author: A. S. Hodel <scotte@eng.auburn.edu>
  42. ## Created: August 1993
  43. ## Adapted-By: jwe
  44.  
  45. function [k, p, e] = lqe (a, g, c, sigw, sigv, zz)
  46.  
  47.   if (nargin != 5 && nargin != 6)
  48.     error ("lqe: invalid number of arguments");
  49.   endif
  50.  
  51.   ## The problem is dual to the regulator design, so transform to lqr
  52.   ## call.
  53.  
  54.   if (nargin == 5)
  55.     [k, p, e] = lqr (a', c', g*sigw*g', sigv);
  56.   else
  57.     [k, p, e] = lqr (a', c', g*sigw*g', sigv, g*zz);
  58.   endif
  59.  
  60.   k = k';
  61.  
  62. endfunction
  63.